﻿<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true"
    CodeFile="ManageCompanies.aspx.cs" Inherits="Administration_ManageCompanies"
    CodeFileBaseClass="BaseView" ViewName="ManageCompanies" %>

<%@ Register Src="../Controls/Common/WaterMarkedTextBox.ascx" TagName="WaterMarkedTextBox"
    TagPrefix="crux" %>
<%@ Register Src="../Controls/Common/ErrorNotification.ascx" TagName="ErrorNotification"
    TagPrefix="crux" %>
<%@ Register Src="../Controls/Common/TableSortSearchPagination.ascx" TagName="TableSortSearchPagination"
    TagPrefix="uc1" %>
<%@ Register src="../Controls/Common/AdditionalButtonsOnGrid.ascx" tagname="AdditionalButtonsOnGrid" tagprefix="uc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <!-- 
        CreativeToDo: The Text Boxes On This Page Don't Change Their BackGround Like Login Page 
             when Validations are not satified 
        -->
    <asp:UpdatePanel ID="updUpdate" runat="server">
        <ContentTemplate>
            <asp:Panel ID="pnlList" runat="server">
                <asp:Panel runat="server" ID="pnlAddCompany">
                    <table cellpadding="0" cellspacing="0" class="toolbar">
                        <tr>
                            <td style="border: 0px;">
                                <asp:ImageButton ID="btnAddNewCompany" runat="server" OnClick="btnAddNewCompany_Click"
                                    meta:resourcekey="btnAddNewCompanyResource1" />
                                &nbsp;<asp:ImageButton ID="btnBack" Text="Back" runat="server" OnClick="btnBack_Click"
                                    ImageUrl="~/appimages/back.gif" />
                            </td>
                        </tr>
                    </table>
                </asp:Panel>
                <table>
                    <tr>
                        <td height="12">
                        </td>
                    </tr>
                </table>
               <uc1:TableSortSearchPagination ID="TableSortSearchPagination1" TargetControlID="grdCompanies"
                    runat="server" ExcludeSortColumnCsv="6" />
                <asp:GridView ID="grdCompanies" runat="server" OnRowDataBound="grdCompanies_RowDataBound"
                    AutoGenerateColumns="False" SkinID="Paginate">
                    <Columns>
                        <asp:BoundField DataField="CompanyID" HeaderText="ID" ItemStyle-CssClass="GridFirstColumn" />
                        <asp:BoundField DataField="CompanyName" HeaderText="Name" />
                        <asp:BoundField DataField="CompanyType" HeaderText="Type" />
                        <asp:BoundField DataField="CompanyBillingAddress" HeaderText="Billing Address" />
                        <asp:BoundField DataField="CompanyMailingAddress" HeaderText="Mailing Address" />
                        <asp:BoundField DataField="CompanyComments" HeaderText="Comments" />
                        <asp:TemplateField HeaderText="Actions" ItemStyle-CssClass="ActionButtons">
                            <ItemTemplate>
                                <center>
                                    <table id="something">
                                        <tr>
                                            <td style="border: 0px">
                                                <asp:Panel ID="pnlEditDeleteCompany" runat="server">
                                                    <asp:ImageButton ID="btnItemEditIcon" runat="server" CausesValidation="false" CommandName="EditItem"
                                                        OnCommand="grdCompanies_RowCommand" CommandArgument='<%#Eval("CompanyID")%>'
                                                        ImageUrl="~/appimages/Edit.gif" ToolTip='<%# "Edit " + Resources.Strings.CompanyText + " details"%>' />
                                                    <asp:ImageButton ID="btnItemDelete" runat="server" CausesValidation="false" CommandName="DeleteItem"
                                                        OnCommand="grdCompanies_RowCommand" CommandArgument='<%#Eval("CompanyID")%>'
                                                        ImageUrl="~/appImages/delete.gif" ToolTip='<%# "Delete " + Resources.Strings.CompanyText %>' />
                                                </asp:Panel>
                                            </td>
                                            <td style="border: 0px">
                                                <!-- CreativeTodo: Have Icon For 'Manage Departments' -->
                                                <asp:ImageButton ID="btnManageCompany" runat="server" CausesValidation="false" CommandName="OpenView"
                                                    OnCommand="grdCompanies_RowCommand" CommandArgument='<%#Eval("CompanyID")%>'
                                                    ImageUrl="~/appimages/manage_company.gif" ToolTip='<%# "Manage " + Resources.Strings.CompanyText %>' />
                                            </td>
                                            <td style="border: 0px">
                                                <asp:Panel runat="server" ID="pnlAdditionalConfigurationBasedButtons">
                                        <uc1:AdditionalButtonsOnGrid runat="server" ObjectID='<%#Eval("CompanyID")%>'
                                            GridName="ManageCompanies" />
                                    </asp:Panel>
                                            </td>
                                        </tr>
                                    </table>
                                </center>
                            </ItemTemplate>
                        </asp:TemplateField>
                    </Columns>
                </asp:GridView>
            </asp:Panel>
            <asp:Panel ID="pnlAddEdit" runat="server">
                <table border="0" cellpadding="0" cellspacing="0" width="100%">
                    <tr>
                        <td class="formTxtHeader" colspan="2">
                            <%= Resources.Strings.CompanyText %>
                            Management
                        </td>
                    </tr>
                    <tr>
                        <td class="formLine" colspan="2">
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2" class="formGroupGap">
                        </td>
                    </tr>
                    <!-- <%# Resources.Strings.CompanyText %> ID -->
                    <tr>
                        <td align="right" valign="middle" class="formLeftColmnWidth">
                            <asp:Label ID="lblCompanyID" runat="server" Text='<%# Resources.Strings.CompanyText + " ID:"%>'
                                CssClass="formLabel"></asp:Label>
                        </td>
                        <td align="left" valign="middle" class="formRightColmnWidth">
                            <asp:Label ID="lblCompanyIDValue" runat="server"></asp:Label>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2" class="formFieldGap">
                        </td>
                    </tr>
                    <!-- <%# Resources.Strings.CompanyText %> Name -->
                    <tr>
                        <td align="right" valign="middle" class="formLeftColmnWidth">
                            <asp:Label ID="lblCompanyName" runat="server" Text='<%# Resources.Strings.CompanyText + " Name:"%>'
                                CssClass="formLabel"></asp:Label>
                        </td>
                        <td align="left" valign="middle" class="formRightColmnWidth">
                            <crux:WaterMarkedTextBox ID="txtCompanyName" WaterMarkText='<%# Resources.Strings.CompanyText +" Name"%>'
                                ValueRequired="true" ErrorText='<%# Resources.Strings.CompanyText + "Name is required."%>'
                                Width="180" MaxLength="50" runat="server" />
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2" class="formFieldGap">
                        </td>
                    </tr>
                    <!-- <%= Resources.Strings.CompanyText %> Billing Address -->
                    <tr>
                        <td align="right" valign="top" class="formLeftColmnWidth formPaddingTop">
                            <asp:Label ID="lblCompanyBillingAddress" runat="server" Text='<%# Resources.Strings.CompanyText + " Billing Address:"%>'
                                CssClass="formLabel"></asp:Label>
                        </td>
                        <td align="left" valign="middle" class="formRightColmnWidth">
                            <crux:WaterMarkedTextBox ID="txtCompanyBillingAddress" WaterMarkText='<%# Resources.Strings.CompanyText + " Billing Address"%>'
                                ValueRequired="false" TextMode="MultiLine" ErrorText='<%# Resources.Strings.CompanyText + " Billing Address is required."%>'
                                Width="180" Height="30" MaxLength="200" runat="server" />
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2" class="formFieldGap">
                        </td>
                    </tr>
                    <!-- <%= Resources.Strings.CompanyText %> Mailing Address -->
                    <tr>
                        <td align="right" valign="top" class="formLeftColmnWidth formPaddingTop">
                            <asp:Label ID="Label1" runat="server" Text='<%# Resources.Strings.CompanyText + " Mailing Address:"%>'
                                CssClass="formLabel"></asp:Label>
                        </td>
                        <td align="left" valign="middle" class="formRightColmnWidth">
                            <crux:WaterMarkedTextBox ID="txtCompanyMailingAddress" WaterMarkText='<%# Resources.Strings.CompanyText + " Mailing Address"%>'
                                ValueRequired="false" TextMode="MultiLine" ErrorText='<%# Resources.Strings.CompanyText + " Mailing Address is required."%>'
                                Width="180" Height="30" MaxLength="200" runat="server" />
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2" class="formFieldGap">
                        </td>
                    </tr>
                    <!-- <%= Resources.Strings.CompanyText %> Type -->
                    <tr>
                        <td align="right" valign="top" class="formLeftColmnWidth formPaddingTop">
                            <asp:Label ID="lblCompanyType" runat="server" Text='<%# Resources.Strings.CompanyText + " Type:"%>'
                                CssClass="formLabel"></asp:Label>
                        </td>
                        <td align="left" valign="middle" class="formRightColmnWidth">
                            <asp:DropDownList ID="drpCompanyType" runat="server">
                            </asp:DropDownList>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2" class="formFieldGap">
                        </td>
                    </tr>
                    <!-- Company Comments -->
                    <tr>
                        <td align="right" valign="top" class="formLeftColmnWidth formPaddingTop">
                            <asp:Label ID="lblCompanyComments" runat="server" Text='<%# Resources.Strings.CompanyText + " Comments:"%>'
                                CssClass="formLabel"></asp:Label>
                        </td>
                        <td align="left" valign="middle" class="formRightColmnWidth">
                            <crux:WaterMarkedTextBox ID="txtCompanyComments" WaterMarkText='<%# Resources.Strings.CompanyText + " Comments"%>'
                                ValueRequired="false" MaxLength="10" TextMode="MultiLine" Width="180" Height="30"
                                runat="server" />
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2" class="formGroupGap">
                        </td>
                    </tr>
                    
                    <tr runat="server" id="trMasterLocations">
                        <td align="right" valign="top" class="formLeftColmnWidth formPaddingTop">
                            <asp:Label ID="Label2" runat="server" Text='<%# Resources.Strings.CompanyText + " Locations:"%>'
                                CssClass="formLabel"></asp:Label>
                        </td>
                        <td align="left" valign="middle" class="formRightColmnWidth">
                           <table><tr><td><asp:ListBox runat="server" ID="ddlAllMasterLocations" Width="100" SelectionMode="Multiple"/></td>
                               <td style="padding-left:10px; padding-right: 10px">
                                   <asp:Button ID="btnSelectLocation" runat="server" Text =">"  OnClick="btnSelectLocation_OnClick" CausesValidation="False"/> <br/>
                                   <asp:Button ID="btnRemoveLocation" runat="server" Text ="<"  OnClick="btnRemoveLocation_OnClick" CausesValidation="False"/> 
                               </td>
                               <td><asp:ListBox runat="server" ID="ddlSelectedMasterLocations" Width="100" SelectionMode="Multiple"/></td>
                                  </tr></table>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2" class="formGroupGap">
                        </td>
                    </tr>

                    <tr>
                        <td>
                        </td>
                        <td align="left">
                            <asp:Button ID="btnSave" runat="server" Text="Save" OnClick="btnSave_Click" />
                            &nbsp;
                            <asp:Button ID="btnCancel" runat="server" CausesValidation="false" Text="Cancel"
                                OnClick="btnCancel_Click" />
                        </td>
                    </tr>
                </table>
            </asp:Panel>
            <crux:ErrorNotification ID="pnlError" runat="server" />
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>
